#include "vernierwidget.h"

VernierWidget::VernierWidget(QString text,QWidget *parent)
    : QWidget{parent}
{
    hLayout = new QHBoxLayout();

    hLayout->setContentsMargins(0,0,0,0);
    hLayout->setSpacing(0);
    setLayout(hLayout);
    hLayout->setAlignment(Qt::AlignHCenter);


    label = new QLabel();
    label->setText(text);
    label->setAlignment(Qt::AlignLeft);
    label->setObjectName("barLabel");

    hSpacer = new QSpacerItem(10, 10,QSizePolicy::Expanding,QSizePolicy::Minimum);

    lineWidget = new QWidget();
    lineWidget->setFixedSize(14,1);
    if(text.isEmpty()){
        lineWidget->setFixedSize(10,1);
        lineWidget->setStyleSheet("QWidget { background-color:rgb(121,131,115);}");
    }else{
        lineWidget->setFixedSize(14,1);
        lineWidget->setStyleSheet("QWidget { background-color:white;}");
    }


    hLayout->addWidget(label);
    hLayout->addSpacerItem(hSpacer);
    hLayout->addWidget(lineWidget);
}
